package com.zishi.venuesbooking.ac;

import android.os.Bundle;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.zishi.venuesbooking.BaseActivity;
import com.zishi.venuesbooking.R;
import com.zishi.venuesbooking.adapter.FriendAdapter;
import com.zishi.venuesbooking.adapter.ReserveAdapter;
import com.zishi.venuesbooking.entity.Friend;
import com.zishi.venuesbooking.entity.Reserve;

import org.json.JSONException;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class MyFriendsActivity extends BaseActivity {


    private RecyclerView rvFriends;
    private FriendAdapter adapter;
    private List<Friend> friends = new ArrayList<>();

    @Override
    protected int initLayout() {
        return R.layout.activity_my_friends;
    }

    @Override
    protected void initView() {
        rvFriends = findViewById(R.id.all_friends_list);

        // 设置朋友列表
        adapter = new FriendAdapter(friends);
        rvFriends.setLayoutManager(new LinearLayoutManager(this));
        rvFriends.setAdapter(adapter);
    }

    @Override
    protected void initData() throws JSONException, IOException {
        loadFriends();
    }

    private void loadFriends() {
        // 模拟数据加载
        List<Friend> friends = new ArrayList<>();
        friends.add(new Friend("1", "1", "file:///android_asset/images/friend/avata_1.png",
                "Diego", "Hello, how are you today", "15:30"
        ));
        friends.add(new Friend("1", "2", "file:///android_asset/images/friend/avata_2.png",
                "Macbook", "HI, how are you today", "15:30"
        ));

        friends.add(new Friend("1", "3", "file:///android_asset/images/friend/avata_3.png",
                "Macbook", "HI, what's up", "15:30"
        ));
        friends.add(new Friend("1", "4", "file:///android_asset/images/friend/avata_4.png",
                "Jockey", "awesome, how are you today", "15:30"
        ));
        friends.add(new Friend("1", "5", "file:///android_asset/images/friend/avata_5.png",
                "Jhon", "Perfect, how are you today", "15:30"
        ));
        adapter.updateData(friends);
        // 从网络或数据库加载评论数据
        // comments.addAll(...);
        // adapter.notifyDataSetChanged();
    }
}